/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package PackageInstaller.Config;

import PackageInstaller.MainUi.JSudoTool;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author wcss
 */
public class TestConfig 
{
    public static void main(String[] args)
    {
        PackageInstallerConfig pic = new PackageInstallerConfig();
        pic.setPackageName("PackageBuilder");
        pic.setTitleText("七彩天空安装程序生成器");
        pic.setPackageVersion("1.0");
        pic.setHomepage("http://www.baidu.com");
        pic.setManager("wcss2020@gmail.com");
        pic.setPackageDepends(new String[][] { {"deb", "openjdk-7-jre"}} );
        pic.setLicenseFile("liense.txt");
        pic.setFinishScriptFile("finish.sh");
        pic.setRemoveScriptFile("remove.sh");
        pic.setWelcome("欢迎使用七彩天空安装程序生成器");
        pic.setTopFlag("五彩书生工作室");
        pic.setParams(new String[][]{{"text","附加参数"}});
        pic.setLogoImage("logo.png");
        try {
            pic.save(pic, "/home/wcss/install.xml");
        } catch (Exception ex) {
            Logger.getLogger(TestConfig.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            
            ArrayList<String> tests = new ArrayList<String>();
            tests.add("gedit /opt/jsoftcenter/softcenterconfig.xml");
            JAppToolKit.JDataHelper.writeAllLines(JAppToolKit.JRunHelper.getCmdRunScriptBufferDir() + "/test.sh", tests);
            JSudoTool.runSudoScript(JAppToolKit.JRunHelper.getCmdRunScriptBufferDir() + "/test.sh");            
                   
        } catch (Exception ex) {
            Logger.getLogger(TestConfig.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}